#include<stdio.h>
int hz(int num)
{
	int k;
	scanf("%d",&num);
		for(int i=2;i<num;i++)
		 	{k=num%i;
		 		if(k==0)
		 		{
		         return 0;
				 }
				 if(i==num-1)
				 {
				 	return 1;
				 }
			 }
		 
}int main()
{
	int num1, num2,Y,B;
	scanf("%d %d", &num1,&num2);
	int  big = (num1 > num2) ? num1 : num2;
	int small = (num1 < num2) ? num1 : num2;
	if (big % small == 0)
	{
		Y = small;
		B = big;
	}
	if (big % small != 0)
	{
		if (hz(num1) == 1 && hz(num2) == 1)
		{
			Y = 1;
			B = num1 * num2;
		}
		else
		{
			int num = 1; B = num1 * num2;
			while (num != 0)
			{Y = num2; B = B / num2;
		}
	}

	printf("%d %d", Y, B);

}



				num = num1 % num2;
				num1 = num2;
				num2 = num;
			}
			